module.exports = function (sequelize) {
    var model = sequelize.define("roleForResources", {
            "roleCode": {
                type: sequelize.DataTypes.STRING(50),
                allowNull: false,
                comment: "角色编号"
            }, "resCode": {
                type: sequelize.DataTypes.STRING(50),
                allowNull: false,
                primaryKey: true,
                comment: "资源编号"
            }
        },
        {
            "tableName": "role_for_resources",
            "timestamps": false,
        });
    model.initRelation = function () {
        model.belongsTo(db.models.resources, {as: "resourcesObj", foreignKey: "resCode", constraints: false});
        model.belongsTo(db.models.role, {as: "roleObj", foreignKey: "roleCode", constraints: false});
    }
    model.initData = new Array();
    model.initData.push({roleCode: "ADMIN", resCode: "WELCOME"});
    model.initData.push({roleCode: "ADMIN", resCode: "SYS_MANAGER"});
    model.initData.push({roleCode: "ADMIN", resCode: "SYS_USER_MANAGER"});
}